﻿Public Class frmMain

    Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        DateTimePicker1.Value = Today
    End Sub

    Private Sub DateTimePicker1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles DateTimePicker1.ValueChanged
        Dim RedeemCode As Integer = GetRedeemCode(DateTimePicker1.Value)
        Label1.Text = RedeemCode.ToString("000000")
    End Sub

    Private Function GetRedeemCode(Arg As Date) As Integer
        Dim DateNum As Integer = CInt(Arg.Ticks \ 864000000000)
        Dim RNG As New Random(DateNum)
        For i = 0 To My.Application.Info.Version.Revision
            RNG.Next(1000000)
        Next
        Return RNG.Next(1000000)
    End Function

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        My.Computer.Clipboard.SetText(Label1.Text)
    End Sub

End Class